package com.plian.system.enumeratea;

import com.plian.spring.SpringUtil;
import com.plian.system.service.cqzc.bondissue.BondsIssueService;
import com.plian.system.service.cqzc.bondsrepayment.BondsRepaymentService;
import com.plian.system.service.fa.nplcancelmaintain.NPLCancelMaintainService;
import com.plian.system.service.fa.nplcancelrecord.NPLCancelRecordService;
import com.plian.system.service.fr.procurement.IPurchaseTransferService;
import com.plian.system.service.im.*;
import com.plian.system.service.pf.IBaseBusinessAnnualService;
import com.plian.system.service.pf.IBaseBusinessIndicatorsService;
import com.plian.system.service.pf.IBaseBusinessProgressService;
import com.plian.system.service.pf.IBaseIndicatorsChangeService;
import com.plian.system.service.pm.annualdonationexecutemain.IAnnualDonationExecuteMainService;
import com.plian.system.service.pm.annualdonationrecordmain.IAnnualDonationRecordMainService;
import com.plian.system.service.pm.property.IPropertyChangeService;
import com.plian.system.service.pm.property.IPropertyOutService;
import com.plian.system.service.pm.property.IPropertyService;
import com.plian.system.service.pm.propertytransaction.IPropertyTransactionService;
import com.plian.system.service.qg.evaluate.IEvaluateReformService;
import com.plian.system.service.qg.guarantee.IPropertyGuaranteeApplyService;
import com.plian.system.service.qg.guarantee.IPropertyGuaranteeExecuteService;
import com.plian.system.service.qg.guarantee.IPropertyGuaranteeRepaymentService;
import com.plian.system.service.qg.subsidiary.ISubsidiaryMixedReformOutService;
import com.plian.system.service.qg.subsidiary.ISubsidiaryMixedReformService;
import com.plian.system.service.yth.IYthDataTransferService;
import lombok.Getter;

import java.util.function.Function;

import static com.plian.system.constant.sys.FormTypeConstant.*;

@Getter
public enum YthDataTransferEnum {

    TEST(0, -1, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //投资制度 TODO DEL
//    InvestmentSystem(1, IM_BASE_INVESTMENT_SYSTEM, SpringUtil.getBean(IInvestmentSystemService.class)::saveInvestmentSystemList),
    //项目信息
    ProjectInfo(2, -1, SpringUtil.getBean(IProjectInfoService.class)::saveProjectInfos),
    //基金项目信息
    FunProjectInfo(3, -1, SpringUtil.getBean(IFundProjectInfoService.class)::saveFundProjectInfos),
    //投资计划
    InvestmentPlan(4, IM_BASE_INVESTMENT_PLAN_FORM, SpringUtil.getBean(IBaseInvestmentPlanService.class)::saveInvestmentPlan),
    //基金项目投资计划执行
    FundProjectExecution(5, IM_FUNDPROJECT_EXECUTION, SpringUtil.getBean(IFundProjectExecutionService.class)::saveFundProjectExecution),
    //项目投资执行
    ProjectExecution(6, IM_BASE_INVESTMENT_EXECUTION_FORM, SpringUtil.getBean(IBaseInvestmentExecutionService.class)::saveProjectExecution),
    //投资负面清单
//    NegativeInvestment(7, IM_NEGATIVE_INVESTMENT, SpringUtil.getBean(NegativeInvestmentService.class)::saveInvestmentNegativeList),
//    //年度投资后评价
//    AnnualInvestmentEvaluation(8, IM_BASE_INVESTMENT_EVALUATION, SpringUtil.getBean(IInvestmentEvaluationService.class)::saveAnnualInvestmentEvaluation),
    //企业收益上缴申报
    //混改登记
    Mixedreforms(12, QG_SUBSIDIARY_FORM, SpringUtil.getBean(ISubsidiaryMixedReformService.class)::saveMixedreforms),
    //混改注销
    OutMixedreforms(14, QG_SUBSIDIARY_OUT_FORM, SpringUtil.getBean(ISubsidiaryMixedReformOutService.class)::saveOutMixedreforms),
    //改革后评价
    EvaluateReform(15, QG_EVALUATE_REFORM, SpringUtil.getBean(IEvaluateReformService.class)::saveEvaluateReform),
    //产权登记
    Property(16, PM_PROPERTY_FORM, SpringUtil.getBean(IPropertyService.class)::ythSubmitBatch),
    //产权变更
    ChangeProperty(17, PM_PROPERTYCHANGE_FORM, SpringUtil.getBean(IPropertyChangeService.class)::ythSubmitBatch),
    //产权注销
    OutProperty(18, PM_PROPERTYOUT_FORM, SpringUtil.getBean(IPropertyOutService.class)::ythSubmitBatch),
    //不良资产核销事前备案
    NPLCancelRecord(19, CQZC_NPL_CANCEL_RECORD, SpringUtil.getBean(NPLCancelRecordService.class)::saveNPLCancelRecordReform),
    //年度不良资产核销
    NPLCancelMaintain(20, CQZC_NPL_CANCEL_MAINTAIN, SpringUtil.getBean(NPLCancelMaintainService.class)::saveNPLCancelMaintainReform),
    //企业年度捐赠计划备案
    AnnualDonationRecord(21, PM_ANNUALDONATIONRECORD_FORM, SpringUtil.getBean(IAnnualDonationRecordMainService.class)::saveAnnualDonationRecordReform),
    //企业年度捐赠计划执行
    AnnualDonationExecute(22, PM_ANNUALDONATIONEXECUTE_FORM, SpringUtil.getBean(IAnnualDonationExecuteMainService.class)::saveAnnualDonationExecuteReform),
    //经营业绩考核指标
    BusinessIndicators(23, PF_BASE_BUSINESS_INDICATORS, SpringUtil.getBean(IBaseBusinessIndicatorsService.class)::saveBaseBusiness),
    //经营业绩考核指标变更
    BusinessIndicatorsChange(55, PF_BASE_BUSINESS_INDICATORS_CHANGE, SpringUtil.getBean(IBaseIndicatorsChangeService.class)::saveChangeBusiness),
    //企业副职差异化考核得分及分配系数
    SubsidiaryScore(24, -1, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //经营业绩考核 责任书
    BusinessResponsibility(25, -1, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //考核进度月报
    AssessmentProgress(26, PF_BUSINESS_REPLENISH, SpringUtil.getBean(IBaseBusinessProgressService.class)::saveBaseBusiness),
    //考核进度年报
    AssessmentProgressYear(27, PF_BUSINESS_ANNUAL, SpringUtil.getBean(IBaseBusinessAnnualService.class)::saveBaseAnnual),
    //企业年金发放情况
//    AnnualPension(28, PF_ENTERPRISE_ANNUITY, SpringUtil.getBean(IBaseEnterpriseAnnuityService.class)::saveEnterpriseAnnuity),
    //履职成效考评-企业评分
    EnterpriseScore(29, -1, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //履职成效考评-考评结果
    AssessmentResult(30, -1, SpringUtil.getBean(IYthDataTransferService.class)::test),
//    PartTimeManagement(35, HR_PART_TIME_FORM, SpringUtil.getBean(INewPartTimeManagementService.class)::savePartTimeManagementReform),
//    //免职
//    PartTimeInfo(36, HR_REMOVAL_FORM, SpringUtil.getBean(INewRemovalManagementService.class)::saveRemoveManagementReform),
    //制度管理
//    TripleSystem(41, PF_TRIPLE_SYSTEM, SpringUtil.getBean(ITripleSystemService.class)::saveTripleSystemList),
//    //事项管理
//    TripleEvent(42, PF_TRIPLE_EVENT, SpringUtil.getBean(ITripleEventService.class)::saveTripleEventList),
//    //会议管理
//    TripleMeeting(43, PF_TRIPLE_MEETING, SpringUtil.getBean(ITripleMeetingService.class)::saveSystemMeetList),
//    //决策执行
//    TopicImplement(44, PF_TRIPLE_TOPIC_IMPLEMENT, SpringUtil.getBean(ITopicImplementService.class)::saveTopicImplementList),
    //债券申请
    //债券发行
    BondsIssue(46, CQZC_BONDISSUE, SpringUtil.getBean(BondsIssueService.class)::ythSubmitBatch),
    //债券偿还
    BondsRepayment(47, CQZC_BONDSREPAYMENT, SpringUtil.getBean(BondsRepaymentService.class)::ythSubmitBatch),
    //担保申请
    PropertyGuaranteeApply(48, QG_GUARANTEE_APPLY_FORM, SpringUtil.getBean(IPropertyGuaranteeApplyService.class)::saveGuaranteeApplyList),
    //担保执行
    PropertyGuaranteeIssue(49, QG_GUARANTEE_EXECUTE_FORM, SpringUtil.getBean(IPropertyGuaranteeExecuteService.class)::saveGuaranteeExecuteList),
    //担保偿还
    PropertyGuaranteeRepayment(50, QG_GUARANTEE_REPAYMENT_FORM, SpringUtil.getBean(IPropertyGuaranteeRepaymentService.class)::saveGuaranteeRepaymentList),
    //工资总额预算/调整
    PayrollAdjustment(51, FR_PAYROLL_ADJUSTMENT, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //产权交易
    PropertyTransaction(52,CQZC_PROPERTYTRANSACTION_FORM,SpringUtil.getBean(IPropertyTransactionService.class)::savePropertyTransactionServiceList),
    //上市公司信息库
//    ListedFirmInfo(53,QM_LISTED_INFORMATION,SpringUtil.getBean(IListedFirmInfoService.class)::saveListedFirm),
    //上市公司重大事件
    //工资总额清算
    PayrollSettlement(55, SYS_AUTO_EXCEL, SpringUtil.getBean(IYthDataTransferService.class)::test),
    //领导薪酬
//    LeadershipPayRecord(56,PF_LEADER_SHIP_RECORD,SpringUtil.getBean(ILeadershipPayRecordService.class)::saveLeadershipRecord),
    //大宗物资采购
    MATERIAL_PROCUREMENT(57, FR_MATERIAL_PROCUREMENT_FORM, SpringUtil.getBean(IPurchaseTransferService.class)::ythSubmitBatch);

    private final int dataType;

    private final int formType;

    private final Function<String, String> function;

    YthDataTransferEnum(int dataType, int formType, Function<String, String> function){
        this.dataType = dataType;
        this.formType = formType;
        this.function = function;
    }


    public static YthDataTransferEnum getByDataType(int dataType){
        for (YthDataTransferEnum value : YthDataTransferEnum.values()){
            if (dataType == value.dataType){
                return value;
            }
        }
        return null;
    }

    public static Function<String, String> getFunction(int dataType){
        for (YthDataTransferEnum value : YthDataTransferEnum.values()){
            if (dataType == value.dataType){
                return value.function;
            }
        }
        return null;
    }
}
